import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
// https://vite.dev/config/
export default defineConfig({
  plugins: [vue()],
  server: {
    proxy: {
      // 代理所有以 /api 开头的请求到后端  
      '/api': {
        target: 'http://82.157.206.194:8041', // 目标服务器的基础 URL  
        changeOrigin: true, // 更改请求的 Origin  
        rewrite: (path) => path.replace(/^\/api/, ''), // 重新映射路径  
      },
    },
  },
  resolve: {
    alias: {
      "@": path.resolve(__dirname, 'src')
    }
  }
})
